Skip to content

Implement more handlers#711

Merged
renkun-ken merged 49 commits intomasterfrom
experimental
Feb 20, 2026
Merged

Implement more handlers#711
renkun-ken merged 49 commits intomasterfrom
experimental

Conversation

@renkun-ken
Copy link
Member

@renkun-ken renkun-ken commented Feb 6, 2026

This PR implements the following handlers:

and makes the following improvements:

  • activeParameters in completion is supported.
image
  • hierarchicalDocumentSymbolSupport is implemented so that class members are displayed in outline.
image
  • The range of top-level symbols are fixed so that symbols defined in global scopes (enclosed in {} with or without if while etc) have correct ranges.
  • Add parse cache and diagnostics cache to reuse existing results of parsed document to be more responsive.
  • Rewrite semantic token extraction and code point calculation in C to reduce R allocation for better performance.
  • Add arg_value_completion so that completion items for the arg values in function like fun(arg = c("value1", "value2", etc)) are supported.

P.S: The code written in this PR is mostly done by @copilot.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the R language server’s LSP feature set (type hierarchy + semantic tokens) and improves responsiveness by adding caching and moving several hot-path operations to C.

Changes:

  • Implement textDocument/prepareTypeHierarchy, typeHierarchy/supertypes, and typeHierarchy/subtypes with supporting class/member extraction.
  • Add textDocument/semanticTokens/full and /range plus server capability wiring.
  • Improve performance via parse/diagnostics caching, task scheduling tweaks, and new C implementations for token scanning, UTF-16/code-point conversion, semantic token encoding, and matching.

Reviewed changes

Copilot reviewed 43 out of 45 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/testthat/test-type-hierarchy.R Adds type hierarchy tests (R6).
tests/testthat/test-symbol.R Adapts symbol range assertions via helper.
tests/testthat/test-symbol-blocks.R Tests symbols in top-level blocks.
tests/testthat/test-signature.R Adds activeParameter test cases.
tests/testthat/test-semantic-tokens.R Adds semantic tokens tests (full/range).
tests/testthat/test-lintr.R Stabilizes lintr tests/config handling.
tests/testthat/test-hover.R Makes hover tests less brittle.
tests/testthat/test-highlight-blocks.R Tests highlights in top-level blocks.
tests/testthat/test-definition-blocks.R Tests definition in top-level blocks.
tests/testthat/helper-utils.R Adds request helpers + tweaks test server startup.
src/token.h Declares C token scanner.
src/token.c Implements fast token scanning in C.
src/semantic.h Declares semantic token encoder.
src/semantic.c Implements semantic token delta encoding in C.
src/match.h Declares C matching helpers.
src/match.c Implements ASCII case-insensitive/fuzzy matching.
src/encoding.h Declares UTF-16/code-point conversion helpers.
src/encoding.c Implements UTF-16/code-point conversion in C.
src/languageserver.c Registers new .Call entry points.
README.md Marks new LSP features as implemented.
R/workspace.R Adds parse/diagnostics caches + cache cleanup.
R/utils.R Adds ASCII detection, C-backed match/fuzzy, C token scan wrapper, and C-backed UTF-16 conversions.
R/type_hierarchy.R Implements type hierarchy logic and class member extraction.
R/task.R Adjusts task scheduling/utilization for parse tasks.
R/symbol.R Adds hierarchical DocumentSymbol support + class member children.
R/signature.R Adds activeParameter computation and parameter range parsing.
R/settings.R Introduces diagnostics cache TTL setting.
R/semantic.R Adds semantic tokens extraction + encoding + handlers.
R/selection.R Formatting/indentation adjustments only.
R/rename.R Formatting/indentation adjustments only.
R/references.R Refactors reference collection to avoid repeated c() growth.
R/languageserver.R Rescales session pool sizes and adds pending reply queues for new requests.
R/interfaces.R Adds document_symbol() constructor for hierarchical symbols.
R/hover.R Updates XPath roots to include more node types.
R/handlers-textsync.R Parses immediately on open (delay=0).
R/handlers-langfeatures.R Adds handlers for type hierarchy + semantic tokens requests.
R/formatting.R Avoids repeated list growth when building edits.
R/document.R Fixes srcref propagation for block parsing + adds parse caching by content hash.
R/diagnostics.R Adds diagnostics caching + explicit linters fallback logic.
R/definition.R Updates XPath roots similarly to hover/signature.
R/completion.R Avoids repeated list growth + updates XPath roots.
R/code_action.R Avoids repeated list growth when collecting actions.
R/capabilities.R Advertises type hierarchy + semantic tokens capabilities.
NAMESPACE Imports digest::digest.
DESCRIPTION Adds digest dependency + updates RoxygenNote.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@renkun-ken renkun-ken merged commit 9a70065 into master Feb 20, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants